class UniqueRandomItem {
		private var originalArray:Array;
		private var selectionArray:Array;
		private var _loop:Boolean = false; 
	public function UniqueRandomItem() {
			this.originalArray = arguments;
			this.selectionArray = new Array();
			this.copyArray(); 
	}
	private function copyArray():Void {
			this.selectionArray.slice(0, this.selectionArray.length); 
			for (var i = 0; i < this.originalArray.length; i++) {
				this.selectionArray.push(this.originalArray[i]); 
			}
		}
		
		public function set loop(loop:Boolean):Void {
			this._loop = loop; 
		}
		
		public function getItem(){
			if (this._loop && (this.selectionArray.length < 1)) {
				this.copyArray(); 
			}
			var randomIndex:Number = Math.floor(Math.random() * (this.selectionArray.length - 1) );
			var item = this.selectionArray.splice(randomIndex, 1)
			trace("original array " + this.originalArray + ' selection array ' + this.selectionArray)
			return item[0]; 
		}
}